﻿//
// Copyright 2008-2011 by Burt Harris
// Licensed under the Microsoft Public License (Ms-PL)
// See: http://www.codeplex.com/yaml/license
//

using System.Collections.Generic;
using System.Runtime.CompilerServices;

namespace YaTools.Yaml
{
    internal sealed class ReferenceEqualityComparer<T>
    : IEqualityComparer<T>
    {
        internal static readonly ReferenceEqualityComparer<T> Instance
            = new ReferenceEqualityComparer<T>();

        private ReferenceEqualityComparer()
        {
        }

        #region IEqualityComparer<T> Members

        public bool Equals(T x, T y)
        {
            return ReferenceEquals(x, y);
        }

        public int GetHashCode(T obj)
        {
            return RuntimeHelpers.GetHashCode(obj);
        }

        #endregion
    }

}
